{template 'common/header'}
{if IMS_VERSION<1}
<link href="{MODULE_URL}/template/static/css/wq1.0.css" rel="stylesheet">
{/if}
<style>
.thumbnail img{min-width: 20px;min-height: 20px;}
 .we7-form input[type=radio], .we7-form input[type=checkbox] {
    display: inline-block;
    cursor: pointer;
}

</style>
{if $op=='display'}
	<div class="we7-page-title">套餐管理</div>
	<ul class="we7-page-tab">
	    <li  class="active" ><a href="javascript:;">套餐列表</a></li>
		<li  ><a href="{php echo $this->createWebUrl('setmeal',array('op'=>'add'));}">+添加用户</a></li>
	</ul>
	<div class="we7-padding-bottom clearfix">
		<form action="./index.php" method="get" role="form" >
			<div class="input-group pull-left col-sm-4">
				<input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="tyzm_diamondvote" />
            <input type="hidden" name="do" value="setmeal" />
            <input type="hidden" name="type" value="{$type}" />
				<input type="text" name="keyword" value="{$keyword}" class="form-control" placeholder="请输入黑名单名称"/>
				<span class="input-group-btn"><button class="btn btn-default"><i class="fa fa-search"></i></button></span>
			</div>
		</form>
		<div class="pull-right">
            <a href="{php echo $this->createWebUrl('setmeal',array('op'=>'add'));}" class="btn btn-primary  we7-margin-left">+添加用户</a>
        </div>
	</div>
	<table class="table we7-table table-hover vertical-middle" id="js-qr-list" ng-controller="QrDisplay" ng-cloak>

		<tr>
		    <th width="80">序号</th>
			<th width="100">用户</th>
			<th class="text-left"width="100">数量</th>
			<th class="text-left"width="100">价格／元</th>
			<th class="text-left"width="110">加入时间</th>
			<th class="text-left"width="110">到期时间</th>
			<th class="text-left"width="50">状态</th>
			<th class="text-left" style="max-width:200px">备注</th>
			<th class="text-left" width="130">操作</th>
		</tr>
		{loop $list $row}
		<tr>
		    <td>{$row['id']}</td>
			<td>{$row['user']}</td>
			<td title="{$row['value']}">{$row['count']}</td>
			<td title="{$row['content']}">{$row['price']}</td>
			<td class="text-left">{php echo date('Y-m-d <br /> H:i:s', $row[starttime]);}</td>
			<td class="text-left">{php echo date('Y-m-d <br /> H:i:s', $row[endtime]);}</td>
			<td class="text-left">{if $row['status']>0 || $row[endtime]<TIMESTAMP || $row[starttime]>TIMESTAMP } <span class="label label-danger">禁用</span> {else} <span class="label label-success">正常</span> {/if}</td>  
			<td class="text-left">{$row['remark']}</td>
			<td class="text-left">
				<div class="link-group">
				        <a href="{php echo $this->createWebUrl('setmeal',array('op'=>'add','id'=>$row['id']));}" >编辑</a>
						<a href="{php echo $this->createWebUrl('setmeal',array('op'=>'delete','id'=>$row['id']));}"  onclick="return confirm('您确定要删除该二维码以及其统计数据吗？')">删除</a>
				</div>
			</td>
		</tr>   
		{/loop}
	</table>
	<div class="help-block">
		
	</div>
	<div class="pull-right">
		{$pager}
	</div>
</div>
<script>
	angular.bootstrap($('#js-qr-list'), ['qrApp']);
</script>

{/if}


{if $op=='add'}
<div class="we7-page-title">添加／编辑用户</div>
	<ul class="we7-page-tab">
	    <li  ><a href="{php echo $this->createWebUrl('setmeal');}">套餐列表</a></li>
	    <li  class="active" ><a href="javascript:;">编辑用户</a></li>
	</ul>
<div class="we7-form">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
		<div class="panel-body" id="step1">
			<div class="panel-body">
			    <div class="form-group">
					<label class="control-label col-sm-2 control-label"><span class="text-danger">*</span> 用户名</label>
					<div class="col-sm-4 col-xs-12">
						<input type="text" class="form-control" name="user" value="{$list['user']}"/>
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-2 control-label"><span class="text-danger">*</span>活动数量</label>
					<div class="col-sm-4">
			            <div class="input-group">
			              <input class="form-control" type="number" value="{$list['count']}" name="count">
			              <span class="input-group-addon">个</span>
			            </div>
			            <span class="help-block"></span>
			          </div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-2 control-label"><span class="text-danger">*</span>价格</label>
					<div class="col-sm-4">
			            <div class="input-group">
			              <input class="form-control" type="number" value="{$list['price']}"name="price">
			              <span class="input-group-addon">元</span>
			            </div>
			            <span class="help-block"></span>
			          </div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-2 control-label"><span class="text-danger">*</span> 联系方式</label>
					<div class="col-sm-4 col-xs-12">
						<input type="text" class="form-control" name="qq" value="{$list['qq']}"/>
						<span class="help-block"><span class="text-danger">*</span>QQ或微信</span>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-2 control-label"><span class="text-danger">*</span> 时间</label>
					<div class="col-sm-4 col-xs-12">
						 {php echo tpl_form_field_daterange('time', array('start'=>date('Y-m-d H:i:s',$list['createtime']),'end'=>date('Y-m-d H:i:s',$list['endtime'])), true)}
			            <div class="help-block">选择最后支付时间</div>
					</div>
				</div>
				
				<div class="form-group">
		          <label class="control-label col-sm-2 control-label">备注</label>
		          <div class="col-sm-8 col-xs-12">
		            <textarea class="form-control" name="remark">{$list['remark']}</textarea>
		            <div class="help-block">图文消息的简介</div>
		          </div>
		        </div>
				  </div>
				<div class="form-group">
					<label class="control-label col-sm-2 control-label">状态</label>
					<div class="col-sm-4 col-xs-12">
						<label class="radio-inline">
						<input type="radio" name="status" value="0" {if $list['status']=='0'} checked {/if} />正常
					    </label>
						<label class="radio-inline">
							<input type="radio" name="status" value="1" {if $list['status']=='1'} checked {/if}  />禁用
						</label>
					
					</div>
				</div>
        </div>	

        <div class="form-group col-sm-12">
			<input name="submit" id="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>

	</form>	
</div>			

{/if}
{template 'common/footer'}